package com.people.netmon.reddit.monitor.controller;

import ai.people.core.standard.analysis.entity.request.JoinAnalysisRequest;
import ai.people.netmon.framework.model.response.Result;
import ai.people.netmon.framework.utils.ResultUtil;
import com.people.netmon.reddit.monitor.service.AccountAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 账户分析控制器
 *
 * @author yuanqinglong
 * @date 2022/3/8 18:49
 */
@Validated
@RestController
@RequestMapping("/account")
public class AccountAnalysisController {


    @Autowired
    private AccountAnalysisService accountAnalysisService;



    /**
     * 添加账户分析
     *
     * @param joinAnalysisRequest 加入分析请求
     * @return {@link Result}<{@link ?}>
     */
    @PostMapping("/joinAnalysis")
    public Result<?> addAccountAnalysis(@Valid @RequestBody JoinAnalysisRequest joinAnalysisRequest){
        accountAnalysisService.addAccountAnalysis(joinAnalysisRequest);
        return ResultUtil.success();
    }


    /**
     * 取消账户分析
     *
     * @param joinAnalysisRequest 加入分析请求
     * @return {@link Result}<{@link ?}>
     */
    @PostMapping("/cancelAnalysis")
    public Result<?> deleteAccountAnalysis(@Valid @RequestBody JoinAnalysisRequest joinAnalysisRequest){
        accountAnalysisService.deleteAccountAnalysis(joinAnalysisRequest);
        return ResultUtil.success();
    }

}
